package com.qfedu.service.impl;
import com.github.pagehelper.PageInfo;
import com.qfedu.dao.PlogerMapper;
import com.qfedu.pojo.entity.Comment;
import com.qfedu.pojo.entity.Commenthzy;
import com.qfedu.pojo.entity.Ploger;
import com.github.pagehelper.PageHelper;
import com.qfedu.pojo.entity.Theme;
import com.qfedu.pojo.resp.BaseResp;
import com.qfedu.service.PlogerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PlogerServiceImpl implements PlogerService {
    @Autowired
    PlogerMapper plogerMapper;
    @Override
    public BaseResp findAll() {
        List<Ploger> all=plogerMapper.findAll();

        return new BaseResp(1,"success",all,(long)all.size());
    }

    @Override
    public BaseResp findByPlogerId(Integer id) {
        List<Ploger> all=plogerMapper.findByPlogerId(id);
        int total=1;
        return new BaseResp(1,"success",all,(long)total);
    }

    @Override
    public BaseResp findAllTheme() {
        List<Theme> all=plogerMapper.findAllTheme();

        return new BaseResp(1,"success",all,(long)all.size());
    }

    @Override
    public BaseResp findCommentByTheme(Integer id) {
        List<Ploger> all=plogerMapper.findCommentByTheme(id);
        return new BaseResp(1,"success",all,(long)all.size());
    }

    @Override
    public BaseResp findCommentByThemeDESC(Integer id) {
        List<Ploger> all=plogerMapper.findCommentByThemeDESC(id);
        return new BaseResp(1,"success",all,(long)all.size());
    }

    @Override
    public BaseResp findCommentByCommentId(Integer id) {
        Commenthzy comment=plogerMapper.findCommentByCommentId(id);
        return  new BaseResp(1,"success",comment,(long)1);
    }
}
